import axios from 'axios';
//login
export const userLogin = (data) => {
    return axios({
        url:'/login/verification',
        data:{
            userName:data.userName,
            password:data.password,
        }
    })
}
//home
export const getHomeData = () => {
    return axios({
        url:'/home/getData',
    })
}
//order
export const getOrderData = () => {
    return axios({
        url:'/order/getData',
    })
}
export const deleteOrderData = (data) => {
    return axios({
        url:'/order/deleteData',
        method:'DELETE',
        data:{
            id:data.id
        }
    })
}
export const addOrderData = (data) => {
    return axios({
        url:'/order/addData',
        method:'POST',
        data:{
            orderNum: data.orderNum,
            orderName: data.orderName,
            orderPho: data.orderPho,
            date: data.date,
            orderState: data.orderState,
            desc: data.desc
        }
    })
}
export const editOrderData = (data) => {
    return axios({
        url:'/order/editData',
        method:'POST',
        data:{
            id:data.id,
            orderNum: data.orderNum,
            orderName: data.orderName,
            orderPho: data.orderPho,
            date: data.date,
            orderState: data.orderState,
            desc: data.desc
        }
    })
}
export const searchOrderData = (data) => {
    return axios({
        url:'/order/searchData',
        data:{
            searchStr:data,
        }
    })
}
export const changeSort = (data) => {
    return axios({
        url:'/order/changeSort',
        data:{
            order:data,
        }
    })
}
//goods
export const getGoodsData = () => {
    return axios({
        url:'/goods/getData',
    })
}
export const editStock = (stock,name) => {
    return axios({
        url:'/goods/editStock',
        method:'POST',
        data:{
            stock,
            name
        }
    })
}